#coding=utf-8

import bpy
import ctypes

from bpy.types import Panel, Menu, Header
from rna_prop_ui import PropertyPanel





import sys
sys.path.append("D:/U/Project/BlenderSandbox")


import engine.initLIB.load_dll as engineLib

'''
import engine.RenderEngine as 引擎绘制
import engine.bl_ui_渲染面板 as 渲染面板
import engine.视口绘制 as 视口绘制




import 场景.bl_ui_场景面板		as ui场景面板
import 物体.bl_ui_物体面板		as ui物体面板
import 物体.bl_ui_物体物理模板	as ui物理模板

import 节点.bl_节点窗口 as nodeWindow'''
from  导入导出 import 场景导入导出

是否已载入模块 = False










class ExampleAddonPreferences(bpy.types.AddonPreferences):
	# this must match the add-on name, use '__package__'
	# when defining this in a submodule of a python package.
	bl_idname = __name__

	filepath: bpy.props.StringProperty(
		name="Example File Path",
		subtype='FILE_PATH',
	)
	number: bpy.props.IntProperty(
		name="Example Number",
		default=4,
	)
	boolean: bpy.props.BoolProperty(
		name="Example Boolean",
		default=False,
	)

	def draw(self, context):
		layout = self.layout
		layout.label(text="This is a preferences view for our add-on")
		layout.prop(self, "filepath")
		layout.prop(self, "number")
		layout.prop(self, "boolean")


class OBJECT_OT_addon_prefs_example(bpy.types.Operator):
	"""Display example preferences"""
	bl_idname = "object.addon_prefs_example"
	bl_label = "Add-on Preferences Example"
	bl_options = {'REGISTER', 'UNDO'}

	def execute(self, context):
		preferences = context.preferences
		addon_prefs = preferences.addons[__name__].preferences

		info = ("Path: %s, Number: %d, Boolean %r" %
				(addon_prefs.filepath, addon_prefs.number, addon_prefs.boolean))

		self.report({'INFO'}, info)
		print(info)

		return {'FINISHED'}













if 是否已载入模块 :
	ui场景面板.unregister()
	ui物体面板.unregister()
	ui物理模板.unregister()
	engineLib.unregister()
	
	视口绘制.unregister()
	引擎绘制.unregister()
	渲染面板.unregister()

	nodeWindow.unregister()
	
	
	是否已载入模块 = False







def register():
	场景导入导出.register()

	'''engineLib.register()
	ui场景面板.register()
	ui物体面板.register()
	ui物理模板.register()
	
	视口绘制.register()
	
	#引擎绘制.register()
	#return
	渲染面板.register()
	
	nodeWindow.register()'''
	
	print('-------------------------------------------------')
	'''engineLib.register()
	ui场景面板.register()
	ui物体面板.register()
	ui物理模板.register()
	nodeWindow.register()
	
	视口绘制.register()
	引擎绘制.register()
	渲染面板.register()'''

	bpy.utils.register_class(OBJECT_OT_addon_prefs_example)
	bpy.utils.register_class(ExampleAddonPreferences)
	
def unregister():
	场景导入导出.unregister()


	'''ui场景面板.unregister()
	ui物体面板.unregister()
	ui物理模板.unregister()
	
	
	视口绘制.unregister()
	#引擎绘制.unregister()
	渲染面板.unregister()
	
	nodeWindow.unregister()
	是否已载入模块 = False
	engineLib.unregister()
	'''

	bpy.utils.unregister_class(OBJECT_OT_addon_prefs_example)
	bpy.utils.unregister_class(ExampleAddonPreferences)

	
	

if __name__ == "__main__" or 是否已载入模块:
	register()
	